package com.zf.zfed.audit.base.fragment

import com.blankj.utilcode.util.FragmentUtils
import com.zf.zfed.audit.R
import com.zf.zfed.audit.set.Navigation
import com.zf.zfed.base.BaseViewModeFragment
import com.zf.zfed.audit.tools.extension.*
import com.zf.zfed.audit.databinding.FragmentNavigationBinding


class NavigationFragment(val T: BaseLogicFragment) : BaseViewModeFragment<FragmentNavigationBinding>(), NavigationBarInterface by T {

    override fun initViews() {
        super.initViews()

        // 载入内容布局
        FragmentUtils.replace(childFragmentManager, T, R.id.fl_content)

        // 标题名
        navTitle()?.let {
            binding.tvBackName.text = it
        }

        // 工具栏
        toolView()?.let {
            binding.flNavigationTool.addView(it)
        }
    }

    override fun initListeners() {
        super.initListeners()

        binding.clBack.singleClick {
            // 返回
            if (canBack()) Navigation.pop()
        }
    }

}